#ifndef __YH_TIMES_H__
#define __YH_TIMES_H__

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

#ifdef __cplusplus
extern "C"
{
#endif

#pragma pack(push)
#pragma pack(1)
#pragma pack(pop)

inline int  maketime(const char *s, time_t *ptime);
inline void times_compact(time_t tim, char *stime, int slen);
inline void times_friendly(time_t tim, char *stime, int slen);

// stime output format: 20121212111111
inline void times_compact(time_t tim, char *stime, int slen);
// stime output format: 2012-12-12 11:11:11
inline void times_friendly(time_t tim, char *stime, int slen);
// stime output format: 2012-12-12-3 11:11:11
inline void times_friendly_week(time_t tim, char *stime, int slen);
// stime output format: Wed Dec 12 11:11:11 2012
inline void times_friendly_english(time_t tim, char *stime, int slen);

// cbtime is times_xxx callback
inline char * fmt_time(time_t t, char *p, size_t len, void (*cbtime)(time_t, char*, int));
inline char * fmt_time_now(char *p, size_t len, void (*cbtime)(time_t, char*, int));

#ifdef __cplusplus
}
#endif
#endif /* __YH_TIMES_H__ */
